package com.khalil.kkadmin.ai.rag.knowledgeset;

import com.khalil.kkadmin.ai.rag.knowledgeset.entity.RagKnowledgeSegment;
import com.khalil.kkadmin.ai.rag.knowledgeset.service.RagKnowledgeSegmentService;
import com.khalil.kkadmin.common.web.ReqBody;
import com.khalil.kkadmin.common.web.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/rag/knowledgeSegment")
public class RagKnowledgeSegmentController {

    @Autowired
    private RagKnowledgeSegmentService ragKnowledgeSegmentService;

    @PostMapping("/list")
    public RespResult<List<RagKnowledgeSegment>> list(@RequestBody ReqBody<String> reqBody) {
        String params = reqBody.getData();
        List<RagKnowledgeSegment> list = ragKnowledgeSegmentService.list(params);
        return RespResult.ok(list);
    }
}
